import jdk.swing.interop.SwingInterOpUtils;

import java.util.Scanner;

public class demo27 {
    public static void main(String[] args) {
        Object locker=new Object();
        Thread t1=new Thread(()->{
            System.out.println("wait唤醒之前");
            synchronized(locker){
                try {
                    locker.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("wait唤醒之后");
        });
        Thread t2=new Thread(()->{
            System.out.println("输入任意内容去唤醒t1");
            Scanner scanner=new Scanner(System.in);
            scanner.nextInt();
            synchronized(locker){
                locker.notify();
            }
        });
        t1.start();
        t2.start();
    }
}
